      PROGRAM NBDTUT
C
C     PROGRAM NBODTUT
C
C
C     INPUT ROUTINE FOR NBOD2
C
C     NBODTUT IS FORTRAN 77 EXCEPT FOR THE "CARRIAGECONTROL" KEYWORD
C          IN THE "OPEN" STATEMENT
C
      IMPLICIT DOUBLE PRECISION(A-H,O-Z)
      INTEGER MESS(18),MES(16),JCON,PCON,FCON
      LOGICAL LRUNGE,LTRNSI,LVDIV,LEQUIV,LTRAN,LTRANV,
     *LRATE,LXDY,LETA,LTORQU,LQFDOT,LDCT,LANGLE,LSETUP,LSIMQ
      LOGICAL DEBUG(15)
      CHARACTER*1 NSTART,LRTAPE,RBLO(10)
      CHARACTER*1 YESNO
      CHARACTER*13 FILNAM
      CHARACTER*7 FOR(0:8),D155,F1513,F1512,F1511,F1510,F159,F158,F157,
     *F156,F155,F154,F153,F152,F151,F150
      DATA FOR(0)/'('/
      DATA D155,F1513,F1512,F1511,F1510,F159,F158,F157,F156,F155,F154,
     *F153,F152,F151,F150
     */'D15.5,','F15.13,','F15.12,','F15.11,','F15.10,','F15.9,',
     *'F15.8,','F15.7,','F15.6,','F15.5,','F15.4,','F15.3,','F15.2,',
     *'F15.1,','F15.0,'/
      DIMENSION XI(9),XMT(9),CA(3),CB(3),THA(3),THAD(3)
     *,HM(3),PCON(11),JCON(10),LCON(10),FCON(10)
      DIMENSION QF(3,3),QL(3,3)
      PRINT*
      PRINT*
      PRINT*
  900 CONTINUE
      PRINT*
      PRINT*
      PRINT*
      PRINT*,'ENTER NAME FOR DATA FILE (E.G. NBOD2.DAT)'
      READ 1000,FILNAM
      IUNIT=1
      OPEN(UNIT=IUNIT,FILE=FILNAM,STATUS='NEW',CARRIAGECONTROL='LIST'
     *,ERR=901)
      GO TO 800
  901 PRINT*
      PRINT*,'ERROR OPENING DATA FILE'
      PRINT*
      PRINT*,'DO YOU WANT TO TRY AGAIN? [Y/N]'
      READ 1001,YESNO
      IF(YESNO.EQ.'Y')THEN
      YESNO='N'
      GO TO 900
      ELSE
      STOP
      END IF
  800 CONTINUE
      PRINT*
      PRINT*,'ENTER 0 IF THIS IS A NEW JOB; 1 IF THIS IS A RESTART JOB'
      READ *,NSTAR
      IF(NSTAR.NE.0.AND.NSTAR.NE.1)THEN
      NSTAR=0
      PRINT*,'YOU MUST ENTER 0 OR 1'
      GO TO 800
      END IF
      IF(NSTAR.EQ.0)NSTART='F'
      IF(NSTAR.EQ.1)NSTART='T'
      PRINT*
      PRINT*,'EQUATIONS THAT DEFINE SYSTEM DYNAMICS ARE CODED IN THE FO
     *LLOWING SUBROUTINES'
      PRINT*,'(THEY MAY BE PRINTED IF DESIRED)'
      PRINT*
      PRINT*,'ENTER 1 IF YOU WANT TO SEE THE SUBROUTINE DESCRIPTIONS'
      PRINT*,'ENTER 0 TO SKIP THEM'
      READ *,IYESNO
      IF(IYESNO.NE.1)GO TO 51
      PRINT*
      PRINT*,'NO.   NAME                         DESCRIPTION'
      PRINT*,'_________________________________________________________
     *_______________________'
      PRINT*
      PRINT*,' 1    RUNGE   NUMERICALLY INTEGRATES THE SET OF SIMULTANE
     *OUS NONLINEAR'
      PRINT*,'              DIFFERENTIAL EQUATIONS {YDOT(t)}={F(t)}'
      PRINT*
      PRINT*,' 2    TRNSIV  COMPUTES INITIAL VALUES FOR ALL REQUIRED TR
     *ANSFORMATION MATRICES'
      PRINT*
      PRINT*,' 3    VDIV    COMPUTES INITIAL VALUES FOR ALL BODY FIXED 
     *VECTORS AND TENSORS'
      PRINT*,'              RELATIVE TO THE FRAME OF COMPUTATION'
      PRINT*
      PRINT*,' 4    EQIV    COMPUTES THE TOTAL # OF 1ST ORDER EQUATIONS
     * TO BE INTEGRATED'
      PRINT*,'              (EXCLUDING THOSE THAT ARE USER DEFINED) AND
     * SETS UP AN ARRAY OF'
      PRINT*,'              INITIAL CONDITIONS IN A FORM COMPATIBLE WIT
     *H SUBROUTINE "RUNGE"'
      PRINT*
      PRINT*,' 5    TRAN    EVALUATES TRANSFORMATION MATRICES'
      PRINT*
      DO I=1,5
      DEBUG(I)=.FALSE.
      END DO
      DO I=1,5
  805 CONTINUE
      PRINT*
      PRINT*,'ENTER NUMBERS OF SUBROUTINES FOR WHICH DATA IS TO BE PRIN
     *TED, ONE AT A TIME'
      PRINT*,'      (I.E. ENTER A NUMBER AND A CARRIAGE RETURN)'
      PRINT*,'ENTER 0 WHEN FINISHED'
      READ *,NDEBUG
      IF(NDEBUG.GT.5)THEN
      NDEBUG=0
      PRINT*,'#S MUST BE .LE. 5'
      GO TO 805
      END IF
      IF(NDEBUG.EQ.0)GO TO 4
      DEBUG(NDEBUG)=.TRUE.
      END DO
    4 CONTINUE
      PRINT*
      PRINT*,'NO.   NAME                         DESCRIPTION'
      PRINT*,'_________________________________________________________
     *_______________________'
      PRINT*
      PRINT*,' 6    TRANVD  TRANSFORMS TO COMPUTING FRAME COORDINATES A
     *LL BODY FIXED VECTORS'
      PRINT*,'              AND TENSORS WHICH ARE USED MORE THAN ONCE I
     *N THE EVALUATION OF'
      PRINT*,'              THE EQUATIONS OF MOTION'
      PRINT*
      PRINT*,' 7    RATE    COMPUTES ALL LINEAR AND ANGULAR VELOCITY VE
     *CTORS THAT WILL BE'
      PRINT*,'              REQUIRED BY THE SUCCEEDING SUBROUTINES'
      PRINT*
      PRINT*,' 8    XDY     COMPUTES ALL REQUIRED HINGE POINT TO CENTER
     * OF MASS POSITION'
      PRINT*,'              VECTORS AND ALL INERTIA AND PSEUDO-INERTIA 
     *TENSORS'
      PRINT*
      PRINT*,' 9    ETA     COMPUTES THE FORCES AND TORQUES ASSOCIATED 
     *WITH THE GYROSCOPIC'
      PRINT*,'              MOTION OF EACH BODY AND EACH NEST OF COUPLE
     *D BODIES'
      PRINT*
      PRINT*,'10    TORQUE  PROVIDES A PLACE FOR THE USER TO DEFINE THE
     * NONGYROSCOPIC FORCES'
      PRINT*,'              AND TORQUES ACTING ON THE PARTICULAR PROBLE
     *M UNDER INVESTIGATION'
      PRINT*
      DO I=6,10
      DEBUG(I)=.FALSE.
      END DO
      DO I=6,10
  806 CONTINUE
      PRINT*
      PRINT*,'ENTER NUMBERS OF SUBROUTINES FOR WHICH DATA IS TO BE PRIN
     *TED, ONE AT A TIME'
      PRINT*,'      (I.E. ENTER A NUMBER AND A CARRIAGE RETURN)'
      PRINT*,'ENTER 0 WHEN FINISHED'
      READ *,NDEBUG
      IF(NDEBUG.GT.10)THEN
      NDEBUG=0
      PRINT*,'#S MUST BE .LE. 10'
      GO TO 806
      END IF
      IF(NDEBUG.EQ.0)GO TO 807
      DEBUG(NDEBUG)=.TRUE.
      END DO
  807 CONTINUE
      PRINT*
      PRINT*,'NO.   NAME                         DESCRIPTION'
      PRINT*,'_________________________________________________________
     *_______________________'
      PRINT*
      PRINT*,'11    QFDOT   ELIMINATES THE FORCES AND TORQUES ASSOCIATE
     *D WITH KINEMATIC'
      PRINT*,'              CONSTRAINTS'
      PRINT*
      PRINT*,'12    DCT     SETS UP THE DIFFERENTIAL EQUATIONS REQUIRED 
     *TO COMPUTE THE'
      PRINT*,'              ELEMENTS OF THE TRANSFORMATION MATRICES THA
     *T ARE TO BE OBTAINED'
      PRINT*,'              BY DIRECTION COSINE TECHNIQUES'
      PRINT*
      PRINT*,'13    ANGLE   SETS UP THE DIFFERENTIAL EQUATIONS REQUIRED
     * TO COMPUTE THE'
      PRINT*,'              DISPLACEMENT COORDINATES THAT ARE MEASURED 
     *ABOUT OR ALONG'
      PRINT*,'              THE FREE COORDINATE VECTORS'
      PRINT*
      PRINT*,'14    SETUP   PROVIDES THE NECESSARY INTERFACE BETWEEN TH
     *E SYMBOLIC ARRAY'
      PRINT*,'              NAMES USED IN THE DERIVATION OF THE EQUATIO
     *NS OF MOTION IN NBOD'
      PRINT*,'              AND THE SYMBOLIC ARRAY NAMES USED IN THE IN
     *TEGRATION SUBROUTINE'
      PRINT*,'              "RUNGE"'
      PRINT*
      PRINT*,'15    SIMQ    OBTAINS THE SOLUTION TO A SET OF SIMULTANEO
     *US LINEAR EQUATIONS'
      PRINT*,'              OF THE FORM [X]{THETADOUBLEDOT}={n}'
      PRINT*
      DO I=11,15
      DEBUG(I)=.FALSE.
      END DO
      DO I=11,15
  808 CONTINUE
      PRINT*
      PRINT*,'ENTER NUMBERS OF SUBROUTINES FOR WHICH DATA IS TO BE PRIN
     *TED, ONE AT A TIME'
      PRINT*,'      (I.E. ENTER A NUMBER AND A CARRIAGE RETURN)'
      PRINT*,'ENTER 0 WHEN FINISHED'
      READ *,NDEBUG
      IF(NDEBUG.GT.15)THEN
      NDEBUG=0
      PRINT*,'#S MUST BE .LE. 15'
      GO TO 808
      END IF
      IF(NDEBUG.EQ.0)GO TO 809
      DEBUG(NDEBUG)=.TRUE.
      END DO
  809 CONTINUE
      GO TO 50
   51 CONTINUE
      DO I=1,15
      DEBUG(I)=.FALSE.
      END DO
      DO I=1,15
  840 CONTINUE
      PRINT*
      PRINT*,'ENTER NUMBERS OF SUBROUTINES FOR WHICH DATA IS TO BE PRIN
     *TED, ONE AT A TIME'
      PRINT*,'      (I.E. ENTER A NUMBER AND A CARRIAGE RETURN)'
      PRINT*,'ENTER 0 WHEN FINISHED'
      READ *,NDEBUG
      IF(NDEBUG.GT.15)THEN
      NDEBUG=0
      PRINT*,'#S MUST BE .LE. 15'
      GO TO 840
      END IF
      IF(NDEBUG.EQ.0)GO TO 841
      DEBUG(NDEBUG)=.TRUE.
      END DO
  841 CONTINUE
   50 CONTINUE
C     DEBUG(1)=LRUNGE
C     DEBUG(2)=LTRNSI
C     DEBUG(3)=LVDIV
C     DEBUG(4)=LEQUIV
C     DEBUG(5)=LTRAN
C     DEBUG(6)=LTRANV
C     DEBUG(7)=LRATE
C     DEBUG(8)=LXDY
C     DEBUG(9)=LETA
C     DEBUG(10)=LTORQU
C     DEBUG(11)=LQFDOT
C     DEBUG(12)=LDCT
C     DEBUG(13)=LANGLE
C     DEBUG(14)=LSETUP
C     DEBUG(15)=LSIMQ
  810 CONTINUE
      PRINT*
      PRINT*,'ENTER 0 TO CREATE A RESTART DATA FILE AT TERMINATION TIME'
      PRINT*,'ENTER 1 OTHERWISE (RESTART DATA FILE WILL NOT BE CREATED)'
      READ *,LRTAP
      IF(LRTAP.NE.0.AND.LRTAP.NE.1)THEN
      LRTAP=0
      PRINT*,'YOU MUST ENTER 0 OR 1'
      GO TO 810
      END IF
      IF(LRTAP.EQ.0)LRTAPE='F'
      IF(LRTAP.EQ.1)LRTAPE='T'
      WRITE(IUNIT,107)NSTART,(DEBUG(I),I=1,15),LRTAPE
      PRINT*
      PRINT*,'ENTER TOTAL NUMBER OF BODIES (RIGID+FLEXIBLE+POINT MASSES)
     *'
      READ *,NBOD
      PRINT*
      WRITE(IUNIT,100)NBOD
C
C     BODY DATA
C
      M=1
      L=1
      DO 201 N=1,NBOD
      PRINT*
      PRINT*,'THE DATA FOR BODY',N,'IS NOW TO BE ENTERED BY YOU'
      PRINT*
      PRINT*,'ENTER ANY ALPHANUMERIC MESSAGE TO BE PRINTED AS A'
      PRINT*,'HEADING FOR BODY',N,'IN THE INPUT DATA ECHO'
      PRINT*,'(72 CHARACTER LIMIT)'
      READ 108,(MESS(I),I=1,18)
      WRITE(IUNIT,105)N,MESS
  815 CONTINUE
      PRINT*
      PRINT*,'ENTER 1 IF BODY',N,'IS A RIGID OR FLEXIBLE BODY'
      PRINT*,'ENTER 0 IF BODY',N,'IS A POINT MASS'
      READ *,IRBLO
      IF(IRBLO.NE.1.AND.IRBLO.NE.0)THEN
      IRBLO=0
      PRINT*,'YOU MUST ENTER 1 OR 0'
      GO TO 815
      END IF
      IF(IRBLO.EQ.0)RBLO(N)='F'
      IF(IRBLO.EQ.1)RBLO(N)='T'
      IF(N.EQ.1)THEN
      JCON(N)=0
      PRINT*
      PRINT*,'BODY 1 IS CONTIGUOUS TO THE INERTIAL REFERENCE FRAME'
      PRINT*
      ELSE IF(N.EQ.2)THEN
      JCON(N)=N-1
      PRINT*
      PRINT*,'BODY 2 IS CONTIGUOUS TO BODY 1'
      PRINT*
      ELSE
  820 CONTINUE
      PRINT*
      PRINT*,'ENTER BODY LABEL OF BODY CONTIGUOUS TO AND INBOARD'
      PRINT*,'OF BODY',N,' (MUST BE .LT.',N,')'
      READ *,JCON(N)
      IF(JCON(N).GE.N)THEN
      JCON(N)=0
      PRINT*,'BODY LABEL MUST BE .LT. ',N
      GO TO 820
      END IF
      END IF
      IF(N.EQ.1)THEN
      PRINT*
      PRINT*,'ENTER NUMBER OF RIGIDLY CONSTRAINED ROTATIONAL'
      PRINT*,'DEGREES OF FREEDOM BETWEEN BODY 1 AND THE'
      PRINT*,'INERTIALLY FIXED REFERENCE FRAME'
      ELSE
  825 CONTINUE
      PRINT*
      PRINT*,'ENTER TOTAL NUMBER OF RIGIDLY CONSTRAINED ROTATIONAL'
      PRINT*,'DEGREES OF FREEDOM AT HINGE POINT',N-1,'OF BODY',N
      END IF
      READ *,PCON(N)
      IF(PCON(N).GT.3)THEN
      PCON(N)=0
      PRINT*,'YOU MUST ENTER 0, 1, 2, OR 3'
      GO TO 825
      END IF
      PRINT*
      PRINT*,'ENTER TOTAL MASS OF BODY',N,'AND ALL IMBEDDED WHEELS'
      PRINT*,'(IF ANY)'
      READ *,XMAS
      WRITE(IUNIT,400)RBLO(N),JCON(N),PCON(N),XMAS
C
C     IF BODY N IS A POINT MASS, SKIP INERTIA SECTION
C
      IF(RBLO(N).EQ.'F')GO TO 60
      PRINT*
      PRINT*,'ENTER INERTIA TENSOR OF BODY',N,'WITH ALL ITS'
      PRINT*,'DESPUN WHEELS (IF ANY) INCLUDED ABOUT ITS CENTER OF'
      PRINT*,'MASS AND RELATIVE TO THE BODY',N,'FIXED REFERENCE FRAME.'
      PRINT*
      PRINT*,'I(1)=_______________     I(2)=_______________     I(3)=__
     *_____________'
      PRINT*
      PRINT*,'********************     I(4)=_______________     I(5)=__
     *_____________'
      PRINT*
      PRINT*,'********************     ********************     I(6)=__
     *_____________'
      PRINT*
      PRINT*,'ENTER SIX ELEMENTS I(1),I(2),I(3),I(4),I(5),I(6)'
      READ *,XI(1),XI(2),XI(3),XI(5),XI(6),XI(9)
   41 CONTINUE
      PRINT*
      PRINT 430,XI(1),XI(2),XI(3)
      PRINT*
      PRINT 431,XI(5),XI(6)
      PRINT*
      PRINT 432,XI(9)
      PRINT*
      PRINT*,'TO CHANGE AN ELEMENT, ENTER ARRAY SUBSCRIPT NUMBER AND NE
     *W VALUE'
      PRINT*,'ENTER 0,0 FOR NO CHANGES'
      PRINT*
      READ *,ISUB,XINEW
      IF(ISUB.EQ.0)GO TO 40
      IF(ISUB.EQ.1.OR.ISUB.EQ.2.OR.ISUB.EQ.3)XI(ISUB)=XINEW
      IF(ISUB.EQ.4.OR.ISUB.EQ.5)XI(ISUB+1)=XINEW
      IF(ISUB.EQ.6)XI(ISUB+3)=XINEW
      GO TO 41
   40 XI(4)=XI(2)
      XI(7)=XI(3)
      XI(8)=XI(6)
      WRITE(IUNIT,401)(XI(I),I=1,3)
      WRITE(IUNIT,402)(XI(I),I=4,6)
      WRITE(IUNIT,403)(XI(I),I=7,9),N
      PRINT*
      IF(N.EQ.1)THEN
      PRINT*,'ENTER TRANSFORMATION MATRIX WHICH TAKES VECTORS FROM'
      PRINT*,'BODY 1 FIXED COORDINATES TO INERTIAL FIXED COORDINATES.'
      ELSE
      PRINT*,'ENTER TRANSFORMATION MATRIX WHICH TAKES VECTORS FROM'
      PRINT*,'BODY',N,'TO BODY',JCON(N),'FIXED COORDINATES WHEN THE'
      PRINT*,'SYSTEM IS IN A ZERO RELATIVE DISPLACEMENT STATE.'
      END IF
      PRINT*
      PRINT*,'ENTER 0 IF TRANSFORMATION MATRIX = IDENTITY MATRIX'
      PRINT*,'ENTER 1 IF NOT (YOU WILL THEN ENTER THE TRANSFORMATION MAT
     *RIX)'
      READ *,IYESNO
      IF(IYESNO.EQ.0)THEN
      XMT(1)=1.
      XMT(2)=0.
      XMT(3)=0.
      XMT(4)=0.
      XMT(5)=1.
      XMT(6)=0.
      XMT(7)=0.
      XMT(8)=0.
      XMT(9)=1.
      ELSE
      PRINT*,'ENTER THIS 3X3 MATRIX ROW BY ROW (9 NUMBERS)'
      PRINT*,'NOTE: THIS MATRIX MUST BE ORTHONORMAL'
      READ *,(XMT(I),I=1,9)
      END IF
      NXMT=0
  500 NXMT=NXMT+1
      DO I=1,3
      IF(NXMT.EQ.1)T=XMT(I)
      IF(NXMT.EQ.2)T=XMT(I+3)
      IF(NXMT.EQ.3)T=XMT(I+6)
      IF(T.LT..00001.OR.T.GE.1.D13)FOR(I)=D155
      IF(T.GE..00001.AND.T.LT.1.)FOR(I)=F1513
      IF(T.GE.1..AND.T.LT.10.)FOR(I)=F1512
      IF(T.GE.10..AND.T.LT.100.)FOR(I)=F1511
      IF(T.GE.100..AND.T.LT.1000.)FOR(I)=F1510
      IF(T.GE.1.D3.AND.T.LT.1.D4)FOR(I)=F159
      IF(T.GE.1.D4.AND.T.LT.1.D5)FOR(I)=F158
      IF(T.GE.1.D5.AND.T.LT.1.D6)FOR(I)=F157
      IF(T.GE.1.D6.AND.T.LT.1.D7)FOR(I)=F156
      IF(T.GE.1.D7.AND.T.LT.1.D8)FOR(I)=F155
      IF(T.GE.1.D8.AND.T.LT.1.D9)FOR(I)=F154
      IF(T.GE.1.D9.AND.T.LT.1.D10)FOR(I)=F153
      IF(T.GE.1.D10.AND.T.LT.1.D11)FOR(I)=F152
      IF(T.GE.1.D11.AND.T.LT.1.D12)FOR(I)=F151
      IF(T.GE.1.D12.AND.T.LT.1.D13)FOR(I)=F150
      END DO
      IF(NXMT.EQ.1)THEN
      FOR(4)='29X,''RO'
      FOR(5)='W 1'')'
      WRITE(IUNIT,FOR)(XMT(I),I=1,3)
      GO TO 500
      END IF
      IF(NXMT.EQ.2)THEN
      FOR(4)='5X,''TRA'
      FOR(5)='NSFORMA'
      FOR(6)='TION MA'
      FOR(7)='TRIX - '
      FOR(8)='ROW 2'')'
      WRITE(IUNIT,FOR)(XMT(I),I=4,6)
      GO TO 500
      END IF
      IF(NXMT.EQ.3)THEN
      FOR(4)='8X,''(ZE'
      FOR(5)='RO REL '
      FOR(6)='DISP)'','
      FOR(7)='6X,''ROW'
      FOR(8)=' 3'')'
      WRITE(IUNIT,FOR)(XMT(I),I=7,9)
      END IF
   60 PRINT*
      IF(N.EQ.1)THEN
      PRINT*,'COMPONENTS OF THE VECTOR FROM HINGE POINT 0'
      PRINT*,'TO THE CENTER OF MASS OF BODY 1 RELATIVE TO THE'
      PRINT*,'BODY 1 FIXED REFERENCE FRAME ARE BY DEFINITION (0,0,0)'
      CA(1)=0.D0
      CA(2)=0.D0
      CA(3)=0.D0
      ELSE
      PRINT*,'ENTER COMPONENTS OF THE VECTOR FROM HINGE POINT',N-1
      PRINT*,'TO THE CENTER OF MASS OF BODY',N,'RELATIVE TO THE'
      PRINT*,'BODY',N,'FIXED REFERENCE FRAME.'
      PRINT*,'THIS VECTOR HAS 3 COMPONENTS'
      READ *,(CA(I),I=1,3)
      END IF
      WRITE(IUNIT,407)(CA(I),I=1,3),N-1,N,N
      PRINT*
      IF(N.EQ.1)THEN
      PRINT*,'ENTER COMPONENTS OF THE VECTOR FROM THE INERTIAL ORIGIN'
      PRINT*,'TO HINGE POINT 0 RELATIVE TO THE INERTIAL '
      PRINT*,'REFERENCE FRAME.'
      PRINT*,'THIS VECTOR HAS 3 COMPONENTS'
      READ *,(CB(I),I=1,3)
      WRITE(IUNIT,408)(CB(I),I=1,3)
      ELSE
      PRINT*,'ENTER COMPONENTS OF THE VECTOR FROM'
      PRINT*,'HINGE POINT',JCON(N)-1,'TO HINGE POINT',N-1
      PRINT*,'RELATIVE TO THE BODY',JCON(N),'FIXED REFERENCE FRAME.'
      PRINT*,'THIS VECTOR HAS 3 COMPONENTS'
      READ *,(CB(I),I=1,3)
      WRITE(IUNIT,409)(CB(I),I=1,3),JCON(N)-1,N-1,JCON(N)
      END IF
    7 CONTINUE
      K=N
C
C     READ IN FREE AND LOCKED COORDINATE VECTORS ALONG WITH INITIAL COND
C
      IF(K.EQ.1) GO TO 12
      M = M + 3 - PCON(K-1)
      L = L + PCON(K-1)

   12 M1 = M+1
      M2 = M+2
      L1 = L+1
      L2 = L+2
      IF(RBLO(K).EQ.'T') GO TO 20
      IASIGN = 1
      GO TO 21
   20 IASIGN = 0
   21 CONTINUE
      IGOTO = PCON(K) + 1
      GO TO (13,14,15,17),IGOTO
C
C     PCON(K) = 0, THREE DEGREES OF FREEDOM
C
   13 IF(RBLO(K).EQ.'T') GO TO 31
      FCON(M)  = K
      FCON(M1) = K
      GO TO 32
   31 FCON(M)  = JCON(K)
C
C     QF(I,M1) COMPUTED FROM QF(1,M) AND QF(1,M2)
C
C        FCON(M1) = -M HELPS LOGIC IN SUBROUTINE TRANVD
      FCON(M1) = -M
   32 FCON(M2) =   K
      PRINT*
      IF(N.EQ.1)THEN
      PRINT*,'ENTER COMPONENTS OF FREE VECTOR',M,'RELATIVE TO THE'
      PRINT*,'INERTIALLY FIXED REFERENCE FRAME.'
      ELSE 
      PRINT*,'ENTER COMPONENTS OF FREE VECTOR',M,'FIXED IN'
      PRINT*,'BODY',FCON(M),'RELATIVE TO THE BODY',FCON(M)
      PRINT*,'FIXED REFERENCE FRAME.'
      END IF
      PRINT*,'THIS VECTOR HAS 3 COMPONENTS (MUST BE A UNIT VECTOR)'
      READ *,(QF(I,M),I=1,3)
      PRINT*
      PRINT*,'ENTER COMPONENTS OF FREE VECTOR',M2
      PRINT*,'FIXED IN BODY',FCON(M2),'RELATIVE TO THE BODY',FCON(M2)
      PRINT*,'FIXED REFERENCE FRAME.'
      PRINT*,'THIS VECTOR HAS 3 COMPONENTS (MUST BE A UNIT VECTOR)'
      READ *,(QF(I,M2),I=1,3)
      NQ=0
  505 NQ=NQ+1
      DO I=1,8
      FOR(I)='       '
      END DO
      DO I=1,3
      J=I
      IF(NQ.EQ.1)T=QF(J,M)
      IF(NQ.EQ.2)T=QF(J,M2)
      IF(T.LT..00001.OR.T.GE.1.D13)FOR(I)=D155
      IF(T.GE..00001.AND.T.LT.1.)FOR(I)=F1513
      IF(T.GE.1..AND.T.LT.10.)FOR(I)=F1512
      IF(T.GE.10..AND.T.LT.100.)FOR(I)=F1511
      IF(T.GE.100..AND.T.LT.1000.)FOR(I)=F1510
      IF(T.GE.1.D3.AND.T.LT.1.D4)FOR(I)=F159
      IF(T.GE.1.D4.AND.T.LT.1.D5)FOR(I)=F158
      IF(T.GE.1.D5.AND.T.LT.1.D6)FOR(I)=F157
      IF(T.GE.1.D6.AND.T.LT.1.D7)FOR(I)=F156
      IF(T.GE.1.D7.AND.T.LT.1.D8)FOR(I)=F155
      IF(T.GE.1.D8.AND.T.LT.1.D9)FOR(I)=F154
      IF(T.GE.1.D9.AND.T.LT.1.D10)FOR(I)=F153
      IF(T.GE.1.D10.AND.T.LT.1.D11)FOR(I)=F152
      IF(T.GE.1.D11.AND.T.LT.1.D12)FOR(I)=F151
      IF(T.GE.1.D12.AND.T.LT.1.D13)FOR(I)=F150
      END DO
      IF(NQ.EQ.1.OR.NQ.EQ.2)THEN
      FOR(4)='5X,''FRE'
      FOR(5)='E VECTO'
      FOR(6)='R '',I2'
      FOR(7)=')'
      IF(NQ.EQ.1)WRITE(IUNIT,FOR)(QF(J,M),J=1,3),M
      IF(NQ.EQ.1)GO TO 505
      IF(NQ.EQ.2)WRITE(IUNIT,FOR)(QF(J,M2),J=1,3),M2
      END IF
      PRINT*
      PRINT*,'NOTE: COMPONENTS OF FREE VECTOR',M1,'WILL BE DEFINED'
      PRINT*,'INTERNALLY BY A VECTOR CROSS PRODUCT'
      PRINT*
      IF(IASIGN.EQ.0)
     *PRINT*,'ENTER RELATIVE DISPLACEMENT ABOUT FREE VECTORS'
      IF(IASIGN.EQ.1)
     *PRINT*,'ENTER RELATIVE DISPLACEMENT ALONG FREE VECTORS'
      PRINT*,M,',',M1,'AND',M2,' (INITIAL CONDITIONS)'
      IF(IASIGN.EQ.0)PRINT*,'UNITS: RAD'
      IF(IASIGN.EQ.1)PRINT*,'UNITS: L'
      READ *,(THA(I),I=M,M2)
      WRITE(IUNIT,411)(THA(I),I=M,M2),M,M1,M2
      PRINT*
      IF(IASIGN.EQ.0)
     *PRINT*,'ENTER RELATIVE RATE OF DISPLACEMENT ABOUT'
      IF(IASIGN.EQ.1)
     *PRINT*,'ENTER RELATIVE RATE OF DISPLACEMENT ALONG'
      PRINT*,'FREE VECTORS',M,',',M1,'AND',M2,' (INITIAL CONDITIONS)'
      IF(IASIGN.EQ.0)PRINT*,'UNITS: RAD/SEC'
      IF(IASIGN.EQ.1)PRINT*,'UNITS: L/T'
      READ *,(THAD(I),I=M,M2)
      WRITE(IUNIT,412)(THAD(I),I=M,M2),M,M1,M2
      GO TO 201
C
C     PCON(K) = 1, TWO DEGREES OF FREEDOM
C
   14 IF(RBLO(K).EQ.'T') GO TO 33
      FCON(M)  = K
      FCON(M1) = K
      LCON(L)  = K
      GO TO 34
   33 FCON(M) = JCON(K)
      FCON(M1) =  K
C
C     QL(I,L) COMPUTED FROM QF(1,M) AND QF(1,M1)
C        LCON(L) = -M HELPS LOGIC IN SUBROUTINE TRANVD
C
      LCON(L) = -M
   34 PRINT*
      IF(N.EQ.1)THEN
      PRINT*,'ENTER COMPONENTS OF FREE VECTOR',M,'FIXED INERTIALLY'
      ELSE 
      PRINT*,'ENTER COMPONENTS OF FREE VECTOR',M,'FIXED IN BODY',FCON(M)
      PRINT*,'RELATIVE TO THE BODY',FCON(M),'FIXED REFERENCE FRAME.'
      END IF
      PRINT*,'THIS VECTOR HAS 3 COMPONENTS (MUST BE A UNIT VECTOR)'
      READ *,(QF(I,M),I=1,3)
      PRINT*
      PRINT*,'ENTER COMPONENTS OF FREE VECTOR',M1
      PRINT*,'FIXED IN BODY',FCON(M1),'RELATIVE TO THE BODY',FCON(M1)
      PRINT*,'FIXED REFERENCE FRAME.'
      PRINT*,'THIS VECTOR HAS 3 COMPONENTS (MUST BE A UNIT VECTOR)'
      READ *,(QF(I,M1),I=1,3)
      NQ=0
  510 NQ=NQ+1
      DO I=1,8
      FOR(I)='       '
      END DO
      DO I=1,3
      J=I
      IF(NQ.EQ.1)T=QF(J,M)
      IF(NQ.EQ.2)T=QF(J,M1)
      IF(T.LT..00001.OR.T.GE.1.D13)FOR(I)=D155
      IF(T.GE..00001.AND.T.LT.1.)FOR(I)=F1513
      IF(T.GE.1..AND.T.LT.10.)FOR(I)=F1512
      IF(T.GE.10..AND.T.LT.100.)FOR(I)=F1511
      IF(T.GE.100..AND.T.LT.1000.)FOR(I)=F1510
      IF(T.GE.1.D3.AND.T.LT.1.D4)FOR(I)=F159
      IF(T.GE.1.D4.AND.T.LT.1.D5)FOR(I)=F158
      IF(T.GE.1.D5.AND.T.LT.1.D6)FOR(I)=F157
      IF(T.GE.1.D6.AND.T.LT.1.D7)FOR(I)=F156
      IF(T.GE.1.D7.AND.T.LT.1.D8)FOR(I)=F155
      IF(T.GE.1.D8.AND.T.LT.1.D9)FOR(I)=F154
      IF(T.GE.1.D9.AND.T.LT.1.D10)FOR(I)=F153
      IF(T.GE.1.D10.AND.T.LT.1.D11)FOR(I)=F152
      IF(T.GE.1.D11.AND.T.LT.1.D12)FOR(I)=F151
      IF(T.GE.1.D12.AND.T.LT.1.D13)FOR(I)=F150
      END DO
      IF(NQ.EQ.1.OR.NQ.EQ.2)THEN
      FOR(4)='5X,''FRE'
      FOR(5)='E VECTO'
      FOR(6)='R '',I2'
      FOR(7)=')'
      IF(NQ.EQ.1)WRITE(IUNIT,FOR)(QF(J,M),J=1,3),M
      IF(NQ.EQ.1)GO TO 510
      IF(NQ.EQ.2)WRITE(IUNIT,FOR)(QF(J,M1),J=1,3),M1
      END IF
      PRINT*
      PRINT*,'NOTE: COMPONENTS OF LOCKED VECTOR',M2,'WILL BE DEFINED'
      PRINT*,'INTERNALLY BY A VECTOR CROSS PRODUCT'
      PRINT*
      IF(IASIGN.EQ.0)
     *PRINT*,'ENTER RELATIVE DISPLACEMENT ABOUT FREE VECTORS'
      IF(IASIGN.EQ.1)
     *PRINT*,'ENTER RELATIVE DISPLACEMENT ALONG FREE VECTORS'
      PRINT*,M,'AND',M1,' (INITIAL CONDITIONS)'
      IF(IASIGN.EQ.0)PRINT*,'UNITS: RAD'
      IF(IASIGN.EQ.1)PRINT*,'UNITS: L'
      READ *,THA(M),THA(M1)
      WRITE(IUNIT,414)THA(M),THA(M1),M,M1
      PRINT*
      IF(IASIGN.EQ.0)
     *PRINT*,'ENTER RELATIVE RATE OF DISPLACEMENT ABOUT'
      IF(IASIGN.EQ.1)
     *PRINT*,'ENTER RELATIVE RATE OF DISPLACEMENT ALONG'
      PRINT*,'FREE VECTORS',M,'AND',M1,' (INITIAL CONDITIONS)'
      IF(IASIGN.EQ.0)PRINT*,'UNITS: RAD/SEC'
      IF(IASIGN.EQ.1)PRINT*,'UNITS: L/T'
      READ *,THAD(M),THAD(M1)
      WRITE(IUNIT,415)THAD(M),THAD(M1),M,M1
      GO TO 201
C
C     PCON(K) = 2  ONE DEGREE OF FREEDOM
   15 IF(RBLO(K).EQ.'T') GO TO 37
      FCON(M)  = K
      LCON(L)  = K
      LCON(L1) = K
      GO TO 38
   37 FCON(M)  = JCON(K)
      LCON(L)  =  K
      LCON(L1) =  K
   38 PRINT*
      IF(N.EQ.1)THEN
      PRINT*,'ENTER COMPONENTS OF FREE VECTOR',M,'FIXED INERTIALLY'
      ELSE 
      PRINT*,'ENTER COMPONENTS OF FREE VECTOR',M,'FIXED IN BODY',FCON(M)
      PRINT*,'RELATIVE TO THE BODY',FCON(M),'FIXED REFERENCE FRAME.'
      END IF
      PRINT*,'THIS VECTOR HAS 3 COMPONENTS (MUST BE A UNIT VECTOR)'
      READ *,(QF(I,M),I=1,3)
      PRINT*
      PRINT*,'ENTER COMPONENTS OF LOCKED VECTOR',L
      PRINT*,'FIXED IN BODY',LCON(L),'RELATIVE TO THE BODY',LCON(L)
      PRINT*,'FIXED REFERENCE FRAME.'
      PRINT*,'THIS VECTOR HAS 3 COMPONENTS (MUST BE A UNIT VECTOR)'
      READ *,(QL(I,L),I=1,3)
      NQ=0
  515 NQ=NQ+1
      DO I=1,8
      FOR(I)='       '
      END DO
      DO I=1,3
      J=I
      IF(NQ.EQ.1)T=QF(J,M)
      IF(NQ.EQ.2)T=QL(J,L)
      IF(T.LT..00001.OR.T.GE.1.D13)FOR(I)=D155
      IF(T.GE..00001.AND.T.LT.1.)FOR(I)=F1513
      IF(T.GE.1..AND.T.LT.10.)FOR(I)=F1512
      IF(T.GE.10..AND.T.LT.100.)FOR(I)=F1511
      IF(T.GE.100..AND.T.LT.1000.)FOR(I)=F1510
      IF(T.GE.1.D3.AND.T.LT.1.D4)FOR(I)=F159
      IF(T.GE.1.D4.AND.T.LT.1.D5)FOR(I)=F158
      IF(T.GE.1.D5.AND.T.LT.1.D6)FOR(I)=F157
      IF(T.GE.1.D6.AND.T.LT.1.D7)FOR(I)=F156
      IF(T.GE.1.D7.AND.T.LT.1.D8)FOR(I)=F155
      IF(T.GE.1.D8.AND.T.LT.1.D9)FOR(I)=F154
      IF(T.GE.1.D9.AND.T.LT.1.D10)FOR(I)=F153
      IF(T.GE.1.D10.AND.T.LT.1.D11)FOR(I)=F152
      IF(T.GE.1.D11.AND.T.LT.1.D12)FOR(I)=F151
      IF(T.GE.1.D12.AND.T.LT.1.D13)FOR(I)=F150
      END DO
      IF(NQ.EQ.1)THEN
      FOR(4)='5X,''FRE'
      FOR(5)='E VECTO'
      FOR(6)='R '',I2'
      FOR(7)=')'
      WRITE(IUNIT,FOR)(QF(J,M),J=1,3),M
      GO TO 515
      END IF
      IF(NQ.EQ.2)THEN
      FOR(4)='5X,''LOC'
      FOR(5)='KED VEC'
      FOR(6)='TOR '',I'
      FOR(7)='2)'
      WRITE(IUNIT,FOR)(QL(J,L),J=1,3),L
      END IF
      PRINT*
      PRINT*,'NOTE: COMPONENTS OF LOCKED VECTOR',L1,'WILL BE DEFINED'
      PRINT*,'INTERNALLY BY A VECTOR CROSS PRODUCT'
      PRINT*
      IF(IASIGN.EQ.0)
     *PRINT*,'ENTER RELATIVE DISPLACEMENT ABOUT FREE VECTOR',M,' (INITIA
     *L CONDITIONS)'
      IF(IASIGN.EQ.1)
     *PRINT*,'ENTER RELATIVE DISPLACEMENT ALONG FREE VECTOR',M,' (INITIA
     *L CONDITIONS)'
      IF(IASIGN.EQ.0)PRINT*,'UNITS: RAD'
      IF(IASIGN.EQ.1)PRINT*,'UNITS: L'
      READ *,THA(M)
      WRITE(IUNIT,418)THA(M),M
      PRINT*
      IF(IASIGN.EQ.0)
     *PRINT*,'ENTER RELATIVE RATE OF DISPLACEMENT ABOUT'
      IF(IASIGN.EQ.1)
     *PRINT*,'ENTER RELATIVE RATE OF DISPLACEMENT ALONG'
      PRINT*,'FREE VECTOR',M,' (INITIAL CONDITIONS)'
      IF(IASIGN.EQ.0)PRINT*,'UNITS: RAD/SEC'
      IF(IASIGN.EQ.1)PRINT*,'UNITS: L/T'
      READ *,THAD(M)
      WRITE(IUNIT,419)THAD(M),M
      GO TO 201
C
C     PCON(K) = 3, ZERO DEGREES OF FREEDOM
C
   17 LCON(L) = K
      LCON(L1) = K
      LCON(L2) = K
      PRINT*
      IF(N.EQ.1)THEN
      PRINT*,'ENTER COMPONENTS OF LOCKED VECTOR',L,'FIXED INERTIALLY.'
      ELSE 
      PRINT*,'ENTER COMPONENTS OF LOCKED VECTOR',L
      PRINT*,'FIXED IN BODY',LCON(L),'RELATIVE TO THE BODY',LCON(L)
      PRINT*,'FIXED REFERENCE FRAME.'
      END IF
      PRINT*,'THIS VECTOR HAS 3 COMPONENTS (MUST BE A UNIT VECTOR)'
      READ *,(QL(I,L),I=1,3)
      PRINT*
      PRINT*,'ENTER COMPONENTS OF LOCKED VECTOR',L1
      PRINT*,'FIXED IN BODY',LCON(L1),'RELATIVE TO THE BODY',LCON(L1)
      PRINT*,'FIXED REFERENCE FRAME.'
      PRINT*,'THIS VECTOR HAS 3 COMPONENTS (MUST BE A UNIT VECTOR)'
      READ *,(QL(I,L1),I=1,3)
      NQ=0
  520 NQ=NQ+1
      DO I=1,8
      FOR(I)='       '
      END DO
      DO I=1,3
      J=I
      IF(NQ.EQ.1)T=QL(J,L)
      IF(NQ.EQ.2)T=QL(J,L1)
      IF(T.LT..00001.OR.T.GE.1.D13)FOR(I)=D155
      IF(T.GE..00001.AND.T.LT.1.)FOR(I)=F1513
      IF(T.GE.1..AND.T.LT.10.)FOR(I)=F1512
      IF(T.GE.10..AND.T.LT.100.)FOR(I)=F1511
      IF(T.GE.100..AND.T.LT.1000.)FOR(I)=F1510
      IF(T.GE.1.D3.AND.T.LT.1.D4)FOR(I)=F159
      IF(T.GE.1.D4.AND.T.LT.1.D5)FOR(I)=F158
      IF(T.GE.1.D5.AND.T.LT.1.D6)FOR(I)=F157
      IF(T.GE.1.D6.AND.T.LT.1.D7)FOR(I)=F156
      IF(T.GE.1.D7.AND.T.LT.1.D8)FOR(I)=F155
      IF(T.GE.1.D8.AND.T.LT.1.D9)FOR(I)=F154
      IF(T.GE.1.D9.AND.T.LT.1.D10)FOR(I)=F153
      IF(T.GE.1.D10.AND.T.LT.1.D11)FOR(I)=F152
      IF(T.GE.1.D11.AND.T.LT.1.D12)FOR(I)=F151
      IF(T.GE.1.D12.AND.T.LT.1.D13)FOR(I)=F150
      END DO
      IF(NQ.EQ.1.OR.NQ.EQ.2)THEN
      FOR(4)='5X,''LOC'
      FOR(5)='KED VEC'
      FOR(6)='TOR '',I'
      FOR(7)='2)'
      IF(NQ.EQ.1)WRITE(IUNIT,FOR)(QL(J,L),J=1,3),L
      IF(NQ.EQ.1)GO TO 520
      IF(NQ.EQ.2)WRITE(IUNIT,FOR)(QL(J,L1),J=1,3),L1
      END IF
      PRINT*
      PRINT*,'NOTE: COMPONENTS OF LOCKED VECTOR',L2,'WILL BE DEFINED'
      PRINT*,'INTERNALLY BY A VECTOR CROSS PRODUCT'
      PRINT*
  201 CONTINUE
      PRINT*
      PRINT*,'THIS IS THE END OF THE BODY DATA'
      PRINT*
  830 CONTINUE
      PRINT*
      PRINT*,'ENTER NUMBER OF KINETICALLY CONSTRAINED TRANSLATIONAL'
      PRINT*,'DEGREES OF FREEDOM BETWEEN BODY 1 AND THE INERTIALLY'
      PRINT*,'FIXED REFERENCE FRAME'
      READ *,PCON(N+1)
      IF(PCON(N+1).GT.3)THEN
      PCON(N+1)=0
      PRINT*,'YOU MUST ENTER 0, 1, 2, OR 3'
      GO TO 830
      END IF
      WRITE(IUNIT,421)PCON(N+1)
      PCON1=PCON(N+1)+1
      PRINT*
      GO TO(300,310,320,330)PCON1
  300 PRINT*,'ENTER INITIAL TRANSLATIONAL RATE ALONG INERTIAL'
      PRINT*,'AXES 1,2,AND 3'
      READ *,(THAD(I),I=1,3)
      WRITE(IUNIT,422)(THAD(I),I=1,3)
      GO TO 330
  310 PRINT*,'ENTER INITIAL TRANSLATIONAL RATE ALONG INERTIAL'
      PRINT*,'AXES 1 AND 2'
      READ *,(THAD(I),I=1,2)
      WRITE(IUNIT,423)(THAD(I),I=1,2)
      GO TO 330
  320 PRINT*,'ENTER INITIAL TRANSLATIONAL RATE ALONG INERTIAL'
      PRINT*,'AXIS 1'
      READ *,THAD(1)
      WRITE(IUNIT,424)THAD(1)
C
C     WHEEL DATA
C
  330 PRINT*
      PRINT*,'ENTER TOTAL NUMBER OF SYMMETRIC WHEELS'
      PRINT*,'IMBEDDED IN THE SYSTEM'
      READ *,NMO
      WRITE(IUNIT,425)NMO
      IF(NMO.GT.0)THEN
      DO J=1,NMO
  835 CONTINUE
      PRINT*
      PRINT*,'ENTER BODY ID NUMBER OF BODY IN WHICH WHEEL',J,'IS'
      PRINT*,'IMBEDDED'
      READ *,MO
      IF(MO.GT.NBOD)THEN
      MO=0
      PRINT*,'BODY ID MUST BE .LE. TOTAL # OF BODIES =',NBOD
      GO TO 835
      END IF
      PRINT*
      PRINT*,'ENTER UNIT VECTOR ALONG WHEEL SPIN AXIS IN BODY',J
      PRINT*,'FIXED COORDINATES.'
      PRINT*,'THIS VECTOR HAS 3 COORDINATES'
      READ *,(HM(I),I=1,3)
      WRITE(IUNIT,426)MO,(HM(I),I=1,3)
      PRINT*
      PRINT*,'ENTER SPIN INERTIA OF WHEEL',J
      READ *,PLM
      PRINT*
      PRINT*,'ENTER MESSAGE TO BE PRINTED WITH WHEEL',J,'DATA ECHO'
      PRINT*,'(64 CHARACTER LIMIT)'
      READ 109,(MES(I),I=1,16)
      WRITE(IUNIT,106)PLM,MES
      PRINT*
      PRINT*,'ENTER INITIAL WHEEL ANGLE OF WHEEL',J
      READ *,THAW
      PRINT*
      PRINT*,'ENTER INITIAL WHEEL RATE OF WHEEL',J
      READ *,THAWD
      WRITE(IUNIT,427)THAW,THAWD,J
      END DO
      END IF
      PRINT*
      PRINT*
      PRINT*,'THIS IS THE END OF THE WHEEL DATA'
      PRINT*
      PRINT*
      PRINT*,'ENTER INTEGRATION STEP SIZE'
      READ *,H
      PRINT*
      PRINT*,'ENTER TIME AT WHICH RUN IS TO BE ENDED'
      READ *,TIMEND
      WRITE(IUNIT,428)H,TIMEND
      PRINT*
      PRINT*,'AMPLIFICATIONS OR MODIFICATIONS TO THE MODEL OR TO THE'
      PRINT*,'EQUATIONS OF MOTION THAT DESCRIBE IT ARE DEFINED BY'
      PRINT*,'SUBROUTINE "INOPT".  THIS TUTORIAL ASSUMES THAT NO'
      PRINT*,'ADDITIONAL DATA IS NEEDED IN "INOPT", WHICH, FOR MOST'
      PRINT*,'SIMULATIONS, WILL BE THE CASE.  THE USER IS REFERRED TO'
      PRINT*,'"THE NBOD2 USER''S AND PROGRAMMER''S MANUAL" FOR MORE INFO
     *RMATION.'
      WRITE(IUNIT,429)
      PRINT*
      PRINT*,'**NOTE** TO RUN THE NBOD PROGRAM ON THE VAX,'
      PRINT*,'         ASSIGN THE DATA FILE CREATED BY NBODTUT TO FOR$RE
     *AD'
      CLOSE(UNIT=1)
  100 FORMAT (I5)
  101 FORMAT (L5,2I5,D15.5)
  102 FORMAT (3D15.5)
  103 FORMAT (3L5)
  104 FORMAT (I5,3D15.5)
  105 FORMAT (I5,18A4)
  106 FORMAT (D15.5,16A4)
  107 FORMAT (4X,A1,15L1,A1)
  108 FORMAT(18A4)
  109 FORMAT(16A4)
  400 FORMAT(A5,2I5,D15.5,20X,'RG/PTM,CONTIG BODY,CDOF,MASS')
  401 FORMAT(3D15.5,5X,'                 ROW 1')
  402 FORMAT(3D15.5,5X,'INERTIA TENSOR - ROW 2')
  403 FORMAT(3D15.5,5X,' (REL BODY ',I2,')','   ROW 3')
  404 FORMAT(3D15.5,5X,'                        ROW 1')
  405 FORMAT(3D15.5,5X,'TRANSFORMATION MATRIX - ROW 2')
  406 FORMAT(3D15.5,5X,'   (ZERO REL DISP)      ROW 3')
  407 FORMAT(3D15.5,5X,'HP ',I2,' TO CM BOD ',I2,' REL BOD ',I2)
  408 FORMAT(3D15.5,5X,'INERT ORIG TO HP 0')
  409 FORMAT(3D15.5,5X,'HP ',I2,' TO HP ',I2,' REL BODY ',I2)
  410 FORMAT(3D15.5,5X,'FREE VECTOR ',I2)
  411 FORMAT(3D15.5,5X,'REL DISP-FREE VECTORS ',I2,',',I2,',',I2)
  412 FORMAT(3D15.5,5X,'REL DIS RATE-FREE VECS',I2,',',I2,',',I2)
  414 FORMAT(2D15.5,20X,'REL DISP-FREE VECTORS ',I2,',',I2)
  415 FORMAT(2D15.5,20X,'REL DISP RATE-FREE VECS ',I2,',',I2)
  417 FORMAT(3D15.5,5X,'LOCKED VECTOR ',I2)
  418 FORMAT(D15.5,35X,'REL DISP - FREE VECTOR ',I2)
  419 FORMAT(D15.5,35X,'REL DISP RATE-FREE VEC ',I2)
  421 FORMAT(I5,45X,'DOF BETWEEN BODY 1 & INERT')
  422 FORMAT(3D15.5,5X,'TRANS RATE - INERT AXES 1,2,3')
  423 FORMAT(2D15.5,20X,'TRANS RATE - INERT AXES 1,2')
  424 FORMAT(D15.5,35X,'TRANS RATE - INERT AXIS 1')
  425 FORMAT(I5,45X,'NUMBER OF WHEELS')
  426 FORMAT(I5,3D15.5,4X,'IN BODY #,SPIN AXIS,/,INER')
  427 FORMAT(2D15.5,20X,'WHEEL ',I2,' ANGLE AND RATE')
  428 FORMAT(2D15.5,20X,'INTEGRATION STEP,TIMEND')
  429 FORMAT(1X,'NO OPTIONS')
  430 FORMAT('I(1)=',G15.5,5X,'I(2)=',G15.5,5X,'I(3)=',G15.5)
  431 FORMAT('********************',5X,'I(4)=',G15.5,5X,'I(5)=',G15.5)
  432 FORMAT('********************     ********************',5X,'I(6)='
     *,G15.5)
 1000 FORMAT(A13)
 1001 FORMAT(A1)
      END
